<template>
	<div class="fillInfo">
		<div class="position-middle-center login_box">
			<div class="login-title">完善基本信息</div>
			<form @submit.prevent="fillInfoFn">
				<div class="phone">
					<!-- <span>手机号</span> -->
					<input type="text" placeholder="请输入名字" v-model="name">
				</div>
				<div class="password">
					<!-- <span>手机号</span> -->
					<input type="text" placeholder="请输入身份证号" v-model="idCardNo">
				</div>
				<div class="login-btn">
					<button  type="submit" >确定</button>
				</div>
			</form>
		</div>
	</div>
</template>

<script type="text/javascript">
export default {
	data(){
		return{
			name:'',
			idCardNo:'',//身份证
		}
	},
	methods: {
		// 重置密码
		fillInfoFn(){
			 if ( !this.name )  {
		        this.$message.error({
		            message: "请输入名字",
		            type: 'error',
		        });
		        return;
		    }
		    if ( !/^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/.test(this.idCardNo) ) {
		        this.$message.error({
		            message: "身份证号格式有误",
		            type: 'error'
		        });
		        return;
		    }
			let body = {
				"name": this.name,
  				"idCardNo": this.idCardNo
			}
			this.$http.put('profile',body).then((res)=>{
				this.$router.replace('index');
			})
		}
	},
	mounted(){
  	}
}
</script>
<style lang="scss" scoped>
	@import "fillInfo";
</style>
